package com.example.unrar;

import com.github.junrar.Junrar;
import com.github.junrar.exception.RarException;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

public class TestRar {

    private static  File tempFolder = new File("d:\\Test");

    public static void main(String[] args) throws Exception{
        test1();
    }

    /**
     * Extract from a file to a directory:
     * @throws RarException
     * @throws IOException
     */
    private static void test1() throws RarException, IOException {
        Junrar.extract("D:\\rar\\desktop.rar", "D:\\xrb");
//or
       // final File rar = new File("foo.rar");
        //final File destinationFolder = new File("destinationFolder");
        //Junrar.extract(rar, destinationFolder);
//or
        //final InputStream resourceAsStream = TestRar.class.getResourceAsStream("foo.rar");//only for a single rar file
        //Junrar.extract(resourceAsStream, tempFolder);
    }
}
